define(['../../carrys/cityList','../../carrys/jsonList','../../../../js/lib/other/sweet-alert'],function(cityData,jsonList) {
    return ['$scope','$location', '$interval','$timeout', function($scope,$location,$interval,$timeout) {
    	$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','loan'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','62'); 	//显示底部文字
    	
    	
    	if(NPLCacheData.secondStepData != null){
    		$scope.propertyName = NPLCacheData.secondStepData.propertyName;
    		$scope.sellerName = NPLCacheData.secondStepData.sellerName;
    		$scope.propertyPrice = NPLCacheData.secondStepData.propertyPrice;
    		$scope.UnderlyingPrice = NPLCacheData.secondStepData.UnderlyingPrice;
    	}else{
    		$scope.propertyName = "";//资产包名称
        	$scope.sellerName = "";//资产包持有者姓名
        	$scope.propertyPrice = ""; //资产报价格
        	$scope.UnderlyingPrice = "";//标的物总金额
    	}
    	
    	//点击下一步
    	$scope.goNext = function(){
    		if(! $scope.propertyName){
    			$scope.$emit("promptAlertMsg","资产包名称不能为空");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(! $scope.sellerName){
    			$scope.$emit("promptAlertMsg","资产包所有者不能为空");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(isNaN($scope.propertyPrice) || !($scope.propertyPrice)){
    			$scope.$emit("promptAlertMsg","资产包价格格式不正确");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(isNaN($scope.UnderlyingPrice) || !($scope.UnderlyingPrice)){
    			$scope.$emit("promptAlertMsg","标的物总额格式不正确");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}
    		
    		saveData();
    	}
    	
    	
    	
    	//保存数据
    	function saveData(){
    		NPLCacheData.secondStepData = {};
		 	NPLCacheData.secondStepData.propertyName = $scope.propertyName;
		 	NPLCacheData.secondStepData.sellerName = $scope.sellerName;
		 	NPLCacheData.secondStepData.propertyPrice = $scope.propertyPrice;
		 	NPLCacheData.secondStepData.UnderlyingPrice = $scope.UnderlyingPrice;
    		
    		$scope.$emit("goNext","/applyNplThird");
    	}
        
    	$scope.$apply();
    }];
});